package com.ahcg

object Demo2 {

  def main(args: Array[String]): Unit = {
    case class Person(name: String, age: Int)
    val alice = new Person("Alice", 25)
    val bob = new Person("Bob", 22)
    val mike = new Person("mike", 24)
    for (person <- List(alice, bob, mike)) {
      person match {
        case Person("Alice", 25) => println("Hi, Alice!")
        case Person("Bob", 22) => println("Hi, Bob!")
        case Person(name, age) => println("name:" + name + "\t" + "age:" + age)
      }
    }
  }
}
